<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/8
 * Time: 13:46
 */
namespace app\blog\controller;
use cmf\controller\AdminBaseController;
use think\Db;

class OperatorController extends AdminBaseController
{    
    public function index()
    {  
        $param = $this->request->param();
        $starttime=isset($param['start_time'])?$param['start_time']:'';
        $endtime=isset($param['end_time'])?$param['end_time']:'';
        $where=array();
        if(!empty($starttime) ) {
            $where['ctime'][]=array('egt',strtotime($starttime));
        }
        if(!empty($endtime) ) {
            $where['ctime'][]=array('lt',24*60*60+strtotime($endtime));
        }
        $operator=isset($param['operator'])?$param['operator']:'';
        $operatorid_list=operator_list($operator);
        if(!empty($operatorid_list)){
            $where['operatorid']=array('in',$operatorid_list);
        }
       $list=Db::name('OperatorStatis')->where($where)->order("id DESC")->paginate(10); 
       // 获取分页显示
       $page = $list->render();
       $this->assign("page", $page);
       $this->assign("list", $list);
       return $this->fetch();        
    }
}